﻿using System.Web.Mvc;
using System.Collections.Generic;
using TeamCommunitySolution.Domain.Extensions;
using TeamCommunitySolution.Extensions;

namespace TeamCommunitySolution.Controllers {
  public static class ControllerHelpers {
    public static void AddRuleViolations(this ModelStateDictionary modelState, IEnumerable<RuleViolation> errors) {
      foreach (RuleViolation issue in errors) {
        modelState.AddModelError(issue.PropertyName, issue.ErrorMessage);
      }
    }
  }
}
